//
// Created by Lenovo on 2021/5/14.
//

#ifndef TSP_FLOYD_H
#define TSP_FLOYD_H
#include <iostream>
const int maxx = 1e9+10;
class Floyd
{
public:
    void build_grahp(int num_city){
        std::cout<<"routenum"<<'\n';
        std::cin>>num_rt;
        //std::cout<<"输入路径，形如 a b val 意为a到b权重为val"<<'\n';
        for(int i = 0;i<num_rt;i++) std::cin>>rt[i].v>>rt[i].u>>rt[i].val;
        for(int i = 0;i<=num_city;i++)
            for(int j = 0;j<=num_city;j++) d[i][j] = maxx;
    }
    void build_mp() {
        for (int i = 0; i < num_rt; i++) d[rt[i].v][rt[i].u] = d[rt[i].u][rt[i].v] = rt[i].val;
    }
    void floyd(int num_city){
        for(int k = 1;k<=num_city;k++)
            for(int i = 1;i<=num_city;i++)
                for(int j = 1;j<=num_city;j++)
                    if(i!=j)d[i][j] = std::min(d[i][j],d[i][k]+d[k][j]);
    }
    int mpval(int i,int j){
        return d[i][j];
    }
private:
    int num_rt;
    struct grahp
    {
        int v,u,val;
    }rt[110];
    int d[110][110];
};
#endif //TSP_FLOYD_H
